﻿Public Class Register
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RegisterUser.ContinueDestinationPageUrl = Request.QueryString("ReturnUrl")
    End Sub

    Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser
        FormsAuthentication.SetAuthCookie(RegisterUser.UserName, False)

        Dim continueUrl As String = String.Format("~/Pages/MemberDetail.aspx?UserName={0}&Action=Edit", RegisterUser.UserName)
        Dim gateway As New SiteUserGateway()

        gateway.Insert(RegisterUser.UserName)
        Roles.AddUserToRole(RegisterUser.UserName, "Member")
        Response.Redirect(continueUrl)
    End Sub
End Class